package com.weixing.mall.provider.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.weixing.mall.provider.mapper.MessageTypeMapper;
import com.weixing.mall.provider.model.domain.MessageType;
import com.weixing.mall.provider.model.dto.MessageTypeDto;
import com.weixing.mall.provider.service.IMessageTypeService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Small
 * @since 2019-11-25
 */
@Service
public class MessageTypeServiceImpl extends ServiceImpl<MessageTypeMapper, MessageType> implements IMessageTypeService {

    @Override
    public void save(MessageTypeDto messageTypeDto) {
        MessageType messageType = new MessageType();
        BeanUtils.copyProperties(messageTypeDto,messageType);
        if(messageTypeDto.getId()==null){
            save(messageType);
        }else {
            updateById(messageType);
        }
    }

    @Override
    public List<MessageType> getList() {
        return baseMapper.selectList(null);
    }
}
